<template>
  <div>
    <div>
      <el-table :data="data" style="width: 100%" :row-key="rowKey" border>
        <el-table-column
          :prop="col.name"
          :label="col.title"
          :type="col.type"
          :width="col.width"
          :align="col.align"
          v-for="(col, index) in cols"
          :key="index"
        >
          <template v-if="col.slot" v-slot="{ row, index }">
            <slot :row="row" :index="index" :name="col.slot"></slot>
          </template>
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    
    cols: {
      type: Array,
      required: true,
      default: () => [],
    },
    rowKey: {
      type: String,
      default: "id",
    },
    data: {
      required: true,
      type: Array,
      default: () => [],
    },
  },
};
</script>

<style lang="scss" scoped>
</style>